#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int n = 0;
    scanf("%d", &n);
    int arr[50] = { 0 };
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
    int num = 0;
    scanf("%d", &num);
    int m = 0;
    for (int i = 0; i < n; i++)
    {
        if (arr[i] == num)
        {
            for (int j = i; j < n; j++)
            {
                arr[j] = arr[j + 1];
            }
            i--;
            m++;
        }
    }
    for (int i = 0; i < n - m; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}